<div appBsModal #modal="bs-modal" class="modal fade" [ngClass]="modalExpandOb.className" tabindex="-1" role="dialog"
    aria-labelledby="modal" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header" style="padding:0.5rem">
                <h5 class="modal-title">
                    <span>{{title}}</span>
                </h5>

                <span class="pull-right" style="display:inline-block">

                    <button (click)="create()" class="btn btn-xs2 btn-primary blue mr-1"
                        *ngIf="'Pages.Administration.CustomConfigs.Create'| permission">
                        <i class="fa fa-plus"></i> {{"CreateNew" | localize}}
                    </button>
                    <button (click)="delete()" class="btn btn-xs2 btn-warning mr-1"
                        *ngIf="'Pages.Administration.CustomConfigs.Delete'| permission">
                        <i class="fa fa-trash"></i>{{"Delete" | localize}}
                    </button>
                    <button (click)="config()" class="btn btn-xs2 btn-sm btn-warning"
                        *ngIf="'Pages.Administration.CustomConfigs.ConfigFileEdit'| permission">
                        <i class="fa fa-cog"></i>{{"ConfigFile" | localize}}
                    </button>

                    <a class="btn btn-smallEx" (click)='modalExpandOb.modalExHandle("small")'>
                        <i class="bi bi-arrows-angle-expand" *ngIf="!modalExpandOb.isSmallEx"></i>
                        <i class="bi bi-arrows-angle-contract" *ngIf="modalExpandOb.isSmallEx"></i>
                    </a>
                    <a class="btn btn-fullscreen" (click)='modalExpandOb.modalExHandle("full")'>
                        <i class="bi bi-arrows-fullscreen" *ngIf="!modalExpandOb.isFullScreen"></i>
                        <i class="bi bi-fullscreen-exit" *ngIf="modalExpandOb.isFullScreen"></i>
                    </a>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
                        <i aria-hidden="true" class="bi bi-x"></i>
                    </button>
                </span>
            </div>
            <div class="modal-body" [busyIf]="loading">
                <form class="form" autocomplete="new-password">
                    <div>
                        <div class="row align-items-center mb-4">
                            <div class="col-xl-12">
                                <div class="form-group m-form__group align-items-center">
                                    <div class="input-group">
                                        <input [(ngModel)]="filterText" name="filterText" autoFocus
                                               class="form-control m-input" [placeholder]="l('SearchWithThreeDot')"
                                               type="text">
                                        <div class="input-group-append">
                                            <button (click)="getListData()" class="btn btn-default"
                                                    type="submit">
                                                <i class="icon-magnifier"
                                                   [attr.aria-label]="l('Search')"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>

                <div class="row align-items-center">
                    <!--<Primeng-TurboTable-Start>-->
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                        <p-table #dataTable sortMode="multiple" (onLazyLoad)="getListData($event)"
                            [value]="primengTableHelper.records"
                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false"
                            [lazy]="true" 
                            [responsive]="primengTableHelper.isResponsive"
                            [resizableColumns]="primengTableHelper.resizableColumns"
                            [(selection)]="selectedDatas"
                            dataKey="id" 
                            selectionMode="multiple">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width:38px">
                                        <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
                                    </th>
                                    <th style="width: 100px">
                                        {{"Select" | localize}}
                                    </th>
                                    <th style="width: 200px">
                                        {{"Name" | localize}}
                                    </th>
                                    <th style="width: 200px">
                                        {{"Description" | localize}}
                                    </th>
                                    <th style="width: 120px">
                                        {{'DataType' | localize}}
                                    </th>
                                    <th style="width: 160px" >
                                        {{"creationTime" | localize}}
                                    </th>
                                    <th style="width: 160px" >
                                        {{"lastModificationTime" | localize}}
                                    </th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit">
                                <tr>
                                    <td style="width: 38px">
                                        <p-tableCheckbox [value]="record" (click)="$event.stopPropagation()"></p-tableCheckbox>
                                     </td>
                                     <td style="width: 100px">
                                        <button type="button"  class="btn btn-xs2 btn-primary blue" (click)="selectItem(record)">{{"Select" | localize}}</button>
                                    </td>
                                    <td style="width: 200px">
                                        <span class="p-column-title">{{"Name" | localize}}</span>
                                        <a title="{{record.name}}" href="javascript:void(0)" (click)="editConfig(record)">{{record.name}}</a>
                                    </td>
                                    <td style="width: 200px">
                                        <span class="p-column-title"> {{"Description" | localize}}</span>
                                        <span title="{{record.description}}">
                                            {{record.description | stringTruncate: 35}}
                                        </span>
                                    </td>
                                    <td style="width: 120px">
                                        <span class="p-column-title"> {{'DataType' | localize}}</span>
                                        {{record.dataType}}
                                    </td>
                                    <td style="width: 160px">
                                        <span class="p-column-title"> {{"CreationTime" | localize}}</span>
                                        {{record.creationTime| luxonFormat:'yyyy-MM-dd'}}
                                    </td>
                                    <td style="width: 160px">
                                        <span class="p-column-title"> {{"MotifyTime" | localize}}</span>
                                        {{record.lastModificationTime | luxonFormat:'yyyy-MM-dd HH:mm:ss'}}
                                    </td>
                                </tr>
                            </ng-template>
                        </p-table>
                        <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                            {{'NoData' | localize}}
                        </div>
                        <div class="primeng-paging-container">
                            <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                (onPageChange)="getListData($event)"
                                [totalRecords]="primengTableHelper.totalRecordsCount"
                                [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage"
                                [showCurrentPageReport]="true"
                                [currentPageReportTemplate]="'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount">
                            </p-paginator>
                        </div>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>

            </div>
        </div>
    </div>
</div>
<custom-config-modal #editConfigModal (callback)="reloadPage()"></custom-config-modal>
<json-editor-modal #jsonEditorModal (callback)="configSave($event)"></json-editor-modal>